package com.yuexunit.finance.project.service;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

import com.yuexunit.finance.project.entity.FinanceOtherMoneyStatementEntity;
import com.yuexunit.inject.annotation.Implements;
import com.yuexunit.page.PageCriteria;
import com.yuexunit.page.PageList;
import com.yuexunit.persist.PersistUtil;
import com.yuexunit.persist.annotation.Transactional;
import com.yuexunit.util.DateUtil;

/**
*@version 创建时间：2017年1月3日 下午9:46:33
*@author wenwenlong
*类说明
*/

@Implements(FinanceOtherMoneyStatementService.class)
public class FinanceOtherMoneyStatementServiceImpl implements FinanceOtherMoneyStatementService {

	@Override
	@Transactional
	public Long createFinanceOtherMoneyStatement(FinanceOtherMoneyStatementEntity entity) {
		entity.setCreateDateTime(DateUtil.now());
		entity.setConfirmState(Boolean.FALSE);
		PersistUtil.insert(entity);
		return entity.getOtherMoneyStatementId();
	}

	@Override
	@Transactional
	public void updateFinanceOtherMoneyStatement(FinanceOtherMoneyStatementEntity entity) {
		PersistUtil.update(entity);
	}

	@Override
	@Transactional
	public void deleteFinanceOtherMoneyStatement(Long otherMoneyStatementId) {
		PersistUtil.delete(FinanceOtherMoneyStatementEntity.class, otherMoneyStatementId);
	}

	@Override
	public FinanceOtherMoneyStatementEntity inquireFinanceOtherMoneyStatement(Long otherMoneyStatementId) {
		return PersistUtil.get(FinanceOtherMoneyStatementEntity.class, otherMoneyStatementId);
	}

	@Override
	public PageList<FinanceOtherMoneyStatementEntity> inquireFinanceOtherMoneyStatementPageList(PageCriteria page) {
		DetachedCriteria criteria = DetachedCriteria.forClass(FinanceOtherMoneyStatementEntity.class);
		return PersistUtil.get(criteria, page);
	}

	@Override
	public List<FinanceOtherMoneyStatementEntity> inquireFinanceOtherMoneyStatementList() {
		DetachedCriteria criteria = DetachedCriteria.forClass(FinanceOtherMoneyStatementEntity.class);
		return PersistUtil.get(criteria);
	}
}
